package com.fsxgt.datagrid.ds.tool;

public class ClickHouseSqlTool extends BaseSqlTool  {
    private volatile static ClickHouseSqlTool single;
    public static ClickHouseSqlTool getInstance() {
        if (single == null) {
            synchronized (ClickHouseSqlTool.class) {
                if (single == null) {
                    single = new ClickHouseSqlTool();
                }
            }
        }
        return single;
    }
    @Override
    public String getSQLQueryTables() {
        return "show tables";
    }
    public String getPageSql(String sql) {
        return
                "SELECT *, rowNumberInAllBlocks() AS rowNo " +
                "    FROM (" + sql + ") " +
                "WHERE rowNo >= ? AND rowNo < ?";

    }
}
